using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
using System.Web;
using System.Windows.Forms;
public class QQUtil
{
	public static Regex regex_0 = new Regex("\\[face\\d{1,3}\\.\\w*\\]");
	public static string string_0 = Application.StartupPath;
	public static string smethod_0(string string_1)
	{
		try
		{
			string_1 = string_1.Replace("<img", "<IMG");
			int num = 0;
			while ((num = string_1.IndexOf("<IMG", num)) != -1)
			{
				int length = string_1.IndexOf("\">", num) - num + 2;
				string text = string_1.Substring(num, length);
				if (text.Contains("sysface=\""))
				{
					int num2 = text.IndexOf("sysface=\"") + 9;
					int length2 = text.IndexOf("\"", num2) - num2;
					try
					{
						string text2 = QQUtil.smethod_2(int.Parse(text.Substring(num2, length2)));
						if (!"".Equals(text2))
						{
							string_1 = string_1.Replace(text, " " + text2);
						}
					}
					catch
					{
					}
				}
				num++;
			}
			return string_1;
		}
		catch
		{
		}
		return string_1;
	}
	public static string smethod_1(string string_1)
	{
		try
		{
			foreach (Match match in QQUtil.regex_0.Matches(string_1))
			{
				string text = match.Value.Replace("[face", "");
				string text2 = QQUtil.smethod_2(int.Parse(text.Substring(0, text.IndexOf("."))));
				if (!"".Equals(text2))
				{
					string_1 = string_1.Replace(match.Value, " " + text2);
				}
			}
		}
		catch
		{
		}
		return string_1;
	}
	public static string smethod_2(int int_0)
	{
		switch (int_0)
		{
		case 0:
			return "/jy";
		case 1:
			return "/pz";
		case 2:
			return "/se";
		case 3:
			return "/fd";
		case 4:
			return "/dy";
		case 5:
			return "/ll";
		case 6:
			return "/hx";
		case 7:
			return "/bz";
		case 8:
			return "/shui";
		case 9:
			return "/dk";
		case 10:
			return "/gg";
		case 11:
			return "/fn";
		case 12:
			return "/tp";
		case 13:
			return "/cy";
		case 14:
			return "/wx";
		case 15:
			return "/ng";
		case 16:
			return "/kuk";
		case 18:
			return "/zk";
		case 19:
			return "/tuu";
		case 20:
			return "/tx";
		case 21:
			return "/ka";
		case 22:
			return "/baiy";
		case 23:
			return "/am";
		case 24:
			return "/jie";
		case 25:
			return "/kun";
		case 26:
			return "/jk";
		case 27:
			return "/lh";
		case 28:
			return "/hanx";
		case 29:
			return "/db";
		case 30:
			return "/fendou";
		case 31:
			return "/zhm";
		case 32:
			return "/yiw";
		case 33:
			return "/xu";
		case 34:
			return "/yun";
		case 35:
			return "/zhem";
		case 36:
			return "/shuai";
		case 37:
			return "/kl";
		case 38:
			return "/qiao";
		case 39:
			return "/zj";
		case 41:
			return "/fad";
		case 42:
			return "/aiq";
		case 43:
			return "/tiao";
		case 46:
			return "/zt";
		case 49:
			return "/yb";
		case 53:
			return "/dg";
		case 54:
			return "/shd";
		case 55:
			return "/zhd";
		case 56:
			return "/dao";
		case 57:
			return "/zq";
		case 59:
			return "/bb";
		case 60:
			return "/kf";
		case 61:
			return "/fan";
		case 63:
			return "/mg";
		case 64:
			return "/dx";
		case 66:
			return "/xin";
		case 67:
			return "/xs";
		case 69:
			return "/lw";
		case 74:
			return "/ty";
		case 75:
			return "/yl";
		case 76:
			return "/qiang";
		case 77:
			return "/ruo";
		case 78:
			return "/ws";
		case 79:
			return "/shl";
		case 85:
			return "/fw";
		case 86:
			return "/oh";
		case 89:
			return "/xig";
		case 96:
			return "/lengh";
		case 97:
			return "/ch";
		case 98:
			return "/kb";
		case 99:
			return "/gz";
		case 100:
			return "/qd";
		case 101:
			return "/huaix";
		case 102:
			return "/zhh";
		case 103:
			return "/yhh";
		case 104:
			return "/hq";
		case 105:
			return "/bs";
		case 106:
			return "/wq";
		case 107:
			return "/kk";
		case 108:
			return "/yx";
		case 109:
			return "/qq";
		case 110:
			return "/xia";
		case 111:
			return "/kel";
		case 112:
			return "/cd";
		case 113:
			return "/pj";
		case 114:
			return "/lq";
		case 115:
			return "/pp";
		case 116:
			return "/sa";
		case 117:
			return "/pch";
		case 118:
			return "/bq";
		case 119:
			return "/gy";
		case 120:
			return "/qt";
		case 121:
			return "/cj";
		case 122:
			return "/aini";
		case 123:
			return "/bu";
		case 124:
			return "/hd";
		case 125:
			return "/zhq";
		case 126:
			return "/kt";
		case 127:
			return "/ht";
		case 128:
			return "/tsh";
		case 129:
			return "/hsh";
		case 130:
			return "/jd";
		case 131:
			return "/jw";
		case 132:
			return "/xw";
		case 133:
			return "/zuotj";
		case 134:
			return "/youtj";
		case 136:
			return "/shx";
		case 137:
			return "/bp";
		case 138:
			return "/dl";
		case 139:
			return "/facai";
		case 140:
			return "/kg";
		case 141:
			return "/gw";
		case 142:
			return "/youjian";
		case 143:
			return "/sq";
		case 144:
			return "/hc";
		case 145:
			return "/qidao";
		case 146:
			return "/baojin";
		case 147:
			return "/bangbangt";
		case 148:
			return "/hn";
		case 149:
			return "/xmian";
		case 150:
			return "/xj";
		case 151:
			return "/fj";
		case 152:
			return "/kch";
		case 153:
			return "/gtl";
		case 154:
			return "/chx";
		case 155:
			return "/gtr";
		case 156:
			return "/duoyun";
		case 158:
			return "/cp";
		case 159:
			return "/xmao";
		case 160:
			return "/dengpao";
		case 161:
			return "/fch";
		case 162:
			return "/nzh";
		case 163:
			return "/dasan";
		case 164:
			return "/cq";
		case 165:
			return "/zuanjie";
		case 166:
			return "/shf";
		case 167:
			return "/zhj";
		case 168:
			return "/yao";
		case 169:
			return "/shq";
		case 170:
			return "/qw";
		}
		return "";
	}
	public static string smethod_3(string string_1)
	{
		try
		{
			string_1 = string_1.Replace("<img", "<IMG");
			int num = 0;
			while ((num = string_1.IndexOf("<IMG", num)) != -1)
			{
				int num2 = string_1.IndexOf("src", num);
				int num3 = string_1.IndexOf("SRC", num);
				int num4 = num2;
				if (num4 == -1 || (num4 > num3 && num3 != -1))
				{
					num4 = num3;
				}
				int num5 = string_1.IndexOf("\"", num4) + 1;
				string text = string_1.Substring(num5, string_1.IndexOf("\"", num5) - num5);
				if (text.StartsWith("file:///"))
				{
					string string_2 = HttpUtility.UrlDecode(text.Replace("file:///", "").Replace("/", "\\")).Replace("%20", " ");
					string str = QQUtil.string_0 + "\\config\\临时文件夹";
					if (!File.Exists(str + "\\ok.png"))
					{
						WebClient webClient = new WebClient();
						webClient.DownloadFile("http://" + Config.user_url + "/update/config/ok.png", str + "\\ok.png");
					}
					if (!File.Exists(str + "\\ng.png"))
					{
						new WebClient().DownloadFile("http://" + Config.user_url + "/update/config/ng.png", str + "\\ng.png");
					}
					bool flag = QQUtil.smethod_4(str + "\\ok.png", string_2);
					bool flag2 = QQUtil.smethod_4(str + "\\ng.png", string_2);
					if (flag || flag2)
					{
						int length = string_1.IndexOf("\">", num) - num + 2;
						string_1 = string_1.Replace(string_1.Substring(num, length), "");
					}
				}
				num++;
			}
		}
		catch
		{
		}
		return string_1;
	}
	public static bool smethod_4(string string_1, string string_2)
	{
		FileInfo fileInfo = new FileInfo(string_1);
		FileInfo fileInfo2 = new FileInfo(string_2);
		return fileInfo.Length == fileInfo2.Length && QQUtil.smethod_5(Image.FromFile(string_1), Image.FromFile(string_2));
	}
	public static bool smethod_5(Image image_0, Image image_1)
	{
		MemoryStream memoryStream = new MemoryStream();
		MemoryStream memoryStream2 = new MemoryStream();
		image_0.Save(memoryStream, ImageFormat.Bmp);
		image_1.Save(memoryStream2, ImageFormat.Bmp);
		byte[] buffer = memoryStream.GetBuffer();
		byte[] buffer2 = memoryStream2.GetBuffer();
		if (buffer.Length != buffer2.Length)
		{
			return false;
		}
		for (int i = 0; i < buffer.Length; i++)
		{
			if (buffer[i] != buffer2[i])
			{
				return false;
			}
		}
		return true;
	}
}
